package com.dems.dao.mapper.la;

import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.dems.dao.dataobject.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;
import java.util.Map;
import java.util.Set;

@Repository
public interface UserMapper extends BaseMapper<User> {
    int deleteByPrimaryKey(String userId);

    int insertSelective(User record);

    User selectByPrimaryKey(String userId);

    int updateByPrimaryKeySelective(User record);

    int updateByPrimaryKey(User record);

    /**
     * 更新附属信息
     * @param record
     * @return
     */
    int updateProfileByPrimaryKey(User record);

    User selectByOpenId(String openId);

    User selectByPhoneNo(String username);

    User selectByCreditAccount(String creditAccount);

//    List<User> selectParentByOpenId(@Param("openIds") List<String> openIds);

    IPage<User> selectParentList(Page page,
                                 @Param("partnerCode") String partnerCode,
                                 @Param("name") String name,
                                 @Param("phoneNo") String phoneNo,
                                 @Param("level") String level,
                                 @Param("userType") String userType,
                                 @Param("userTypeList") List<String> userTypeList,
                                 @Param("partnerCodeList") List<String> partnerCodeList
                                 );

    List<User> selectUserByPartnerCode(@Param("partnerCodes") Set<String> partnerCodes);


    List<User> selectUserByInviteCode(@Param("inviteCodes") Set<String> inviteCodes);

    List<User> selectAllocateUser(@Param("keyword") String keyword);

    List<User> selectTUser();

    List<User> selectByIdList(@Param("userIdList") List<String> userIdList);

    User selectByName(@Param("name") String name);

    User selectBySipAccount(@Param("sipAccount") String sipAccount, @Param("callCenter") String callCenter);

    List<User> selectBySipAccountList(@Param("sipAccountList") List<String> sipAccountList);

    List<User> selectVUser(@Param("city") String city, @Param("companyId") String companyId, @Param("roleCodeList") List<String> roleCodeList);

    List<User> selectPreBankUser();

    List<Map<String, Object>> selectRepayInfoByUser(@Param("userIdList") List<String> userIdList, @Param("startDate") String startDate, @Param("endDate") String endDate);

    List<User> selectByCompanyId(@Param("companyId") String companyId);
}